#region Using References

using System;
using System.Diagnostics.Contracts;

#endregion

namespace Beaker.Services.FileSystem
{
	[ContractClass( typeof( FileSystemServiceProviderContracts ) )]
	public interface IFileSystemServiceProvider
	{
		/// <summary>
		/// Tries to convert the file to a filesystem service, if possible.
		/// </summary>
		/// <param name="file">The file to convert to a filesystem.</param>
		/// <returns>A FileSystemService, or <c>null</c> if the file cannot be converted.</returns>
		IFileSystemService FromFile( IFile file );
	}

	[ContractClassFor( typeof( IFileSystemServiceProvider ) )]
	public abstract class FileSystemServiceProviderContracts
		: IFileSystemServiceProvider
	{
		public IFileSystemService FromFile( IFile file )
		{
			Contract.Ensures( Contract.Result<IFileSystemService>() == null
				|| Contract.Result<IFileSystemService>() is IFile,
						"the result should also stil be an File, like the file it wraps." );

			throw new NotImplementedException();
		}
	}
}